<template>
  <div class="mod-config">
    <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
      <el-form-item>
        <el-input v-model="dataForm.servicecode" placeholder="业务标识码" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="dataForm.serviceno" placeholder="业务件号" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-input v-model="dataForm.realtyno" placeholder="不动产登记证明号" clearable></el-input>
      </el-form-item>

      <el-form-item>
          <el-select v-model="dataForm.state" clearable placeholder="交易状态">
            <el-option
              v-for="item in options"
              :key="item.code"
              :label="item.name"
              :value="item.code">
            </el-option>
          </el-select>
      </el-form-item>

      <el-form-item>
        <el-button @click="getDataList()">查询</el-button>

      </el-form-item>
    </el-form>
    <el-table
      :data="dataList"
      border
      v-loading="dataListLoading"
      @selection-change="selectionChangeHandle"
      style="width: 100%;">
      <el-table-column
        type="selection"
        header-align="center"
        align="center"
        width="50">
      </el-table-column>

            <el-table-column
        prop="stateTranslate"
        header-align="center"
        align="center"
          width="110"
        label="审核状态">
      </el-table-column>

      <el-table-column
        prop="sendtime"
        header-align="center"
        align="center"
        width="160px"
        label="更新时间">
      </el-table-column>

      <el-table-column
        prop="servicecode"
        header-align="center"
        align="center"
        width="180px"
        label="业务标识码">
      </el-table-column>

      <el-table-column
        prop="realtyno"
        header-align="center"
        align="center"
        width="160px"
        label="不动产登记证明号">
      </el-table-column>

      <el-table-column
        prop="bdbzqse"
        header-align="center"
        align="center"
        width="120px"
        label="被担保债权数额">
      </el-table-column>
      <el-table-column
        prop="zwlxqssj"
        header-align="center"
         width="140px"
        align="center"
        label="债务履约起始时间">
      </el-table-column>
      <el-table-column
        prop="zwlxjssj"
       width="140px" 
        header-align="center"
        align="center"
        label="债务履约结束时间">
      </el-table-column>

      <el-table-column
        prop="isdygh"
        header-align="center"
        align="center"
        width="140px"
        label="带抵押过户标识">
      </el-table-column>

      <el-table-column
        prop="serviceno"
        header-align="center"
        align="center"
        width="140px"
        label="业务件号">
      </el-table-column>
      <el-table-column
        prop="slh"
        header-align="center"
        align="center"
        width="120px"
        label="受理号">
      </el-table-column>

      <el-table-column
        fixed="left"
        header-align="center"
        align="center"
        width="150"
        label="操作">
        <template slot-scope="scope">
          <el-button type="text" v-if="scope.row.state=='29'" size="small"    
            @refreshDataList="getDataList"  @click="cancelcheck(scope.row.seqno)">复核</el-button>
          <el-button type="text" size="small" @click="detailHandle(scope.row.seqno)">显示详情</el-button>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="datepicker.pageOptions"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper">
    </el-pagination>
    <!-- 弹窗, 新增 / 修改 -->

  
    <cancel-new v-if="cancelNewVisible" ref="cancelNew"   @refreshDataList="getDataList" ></cancel-new> 
    <cancel-detail v-if="cancelDetailVisible" ref="cancelDetail"   @refreshDataList="getDataList" ></cancel-detail> 

  </div>



</template>

<script>

  import CancelDetail from './cancel-detail' 
  import CancelNew from './cancel-register-new' 
  export default {
    data () {
      return {
        options: [],
        dataForm: {
          key: ''
        },
        dataList: [],
        pageIndex: 1,
        pageSize: 10,
        totalPage: 0,
        dataListLoading: false,
        dataListSelections: [],
        cancelDetailVisible: false,
        cancelNewVisible: false
      }
    },
    components: {
      CancelDetail,
      CancelNew
    },
    activated () {
      this.getDataList()
      this.initOptions()
    },
    methods: {

      detailHandle(id){
          this.cancelDetailVisible = true
          this.$nextTick(() => {
            this.$refs.cancelDetail.init(1, id)
          })
      },

      cancelcheck(id){
          this.cancelNewVisible = true
          this.$nextTick(() => {
            this.$refs.cancelNew.init(1, id)
          })
      },
            initOptions(){
          this.$http({
            url: this.$http.adornUrl(`/bdc/bdcstateinfo/item/list`),
            method: 'get',
            params: this.$http.adornParams()
          }).then(({data}) => {
            this.options = data.list
          })
      },

      // 获取数据列表
      getDataList () {
        this.dataListLoading = true
        this.$http({
          url: this.$http.adornUrl('/bdc/cancelregist/list'),
          method: 'get',
          params: this.$http.adornParams({
            'page': this.pageIndex,
            'limit': this.pageSize,
            'realtyno': this.dataForm.realtyno,
            'servicecode': this.dataForm.servicecode,
            'serviceno': this.dataForm.serviceno
          })
        }).then(({data}) => {
          if (data && data.code === 0) {
            this.dataList = data.page.list
            this.totalPage = data.page.totalCount
          } else {
            this.dataList = []
            this.totalPage = 0
          }
          this.dataListLoading = false
        })
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        this.getDataList()
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        this.getDataList()
      },
      // 多选
      selectionChangeHandle (val) {
        this.dataListSelections = val
      }

    }
  }
</script>
<style lang="scss">
body .el-table th.gutter{
    display: table-cell!important;

}
</style>